import React,{useImperativeHandle}from 'react'
import { Form, Input } from 'antd';
function GoodsAttr(props: GoodParamsPropsType,ref:any) {
  let [form] =Form.useForm();
  console.log(props)
  useImperativeHandle(ref,()=>{
    return {
      form
    }
  })
  return (
    <div>
      <Form layout='vertical' form={form}>
        {
          props.params.map((item: ParamsAttrType, index: number) => {
            return (
              <Form.Item
                label={item.attr_name}
                name={item.attr_id}
                key={index}
                initialValue={item.attr_vals}
              >
                <Input />
              </Form.Item>
           )
          })
        }
      </Form>
    </div>
  )
}

export default React.forwardRef(GoodsAttr);